#pragma once
#include <xact3.h>

class SoundObject
{
private:
	IXACT3Engine*		m_pEngine;		// XACT3 engine
    IXACT3WaveBank*		m_pWaveBank;	// XACT3 wave bank holds WAVES
    IXACT3SoundBank*	m_pSoundBank;	// XACT3 sound bank holds SOUNDS
    VOID*				m_pbWaveData;	// Pointer to wave bank data
										// Delete it when receive notification that the wave bank is destroyed
    VOID*				m_pbSoundData;	// Pointer to sound bank data
										// Can delete it when receive notification that the sound bank is destroyed

	HRESULT PrepareXACT();

	bool FileExists(const char* cszFileName);
	void CleanupXACT();									// shut down XACT and clean up memory allocations
	DWORD LoadFileToMemory(const char* cszFileName, void*& pDataPointer);


public:

	//=====STRUCTORS
	SoundObject();
	SoundObject(const SoundObject& copyFromMe);
	virtual ~SoundObject();
	
	WORD GetCue(const char* cszCue);	

	HRESULT LoadSounds(const char* cszName);
	HRESULT DoWork() { return m_pEngine->DoWork(); }
	HRESULT PlayCue(const char* cszCue);
	HRESULT PlayCue(WORD wCueIndex);
};
